.class public Lcom/brixd/niceapp/util/DownloadUtils;
.super Ljava/lang/Object;
.source "DownloadUtils.java"


# direct methods
.method public constructor <init>()V
    .registers 1

    .prologue
    .line 21
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static analysisDownloadClick(Ljava/lang/String;ILcom/zuiapps/sdk/analytics/constant/MobclickConstant$NiceChannelClick;)V
    .registers 4
    .param p0, "source"    # Ljava/lang/String;
    .param p1, "appId"    # I
    .param p2, "channelClick"    # Lcom/zuiapps/sdk/analytics/constant/MobclickConstant$NiceChannelClick;

    .prologue
    .line 48
    new-instance v0, Lcom/brixd/niceapp/util/DownloadUtils$1;

    invoke-direct {v0, p2, p0, p1}, Lcom/brixd/niceapp/util/DownloadUtils$1;-><init>(Lcom/zuiapps/sdk/analytics/constant/MobclickConstant$NiceChannelClick;Ljava/lang/String;I)V

    .line 61
    invoke-virtual {v0}, Lcom/brixd/niceapp/util/DownloadUtils$1;->start()V

    .line 62
    return-void
.end method

.method public static goToDownloadHistory(Landroid/content/Context;)V
    .registers 3
    .param p0, "context"    # Landroid/content/Context;

    .prologue
    .line 65
    new-instance v0, Landroid/content/Intent;

    const-class v1, Lcom/zuimeia/sdk/download/providers/downloads/ui/ZMDownloadListActivity;

    invoke-direct {v0, p0, v1}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 66
    .local v0, "it":Landroid/content/Intent;
    const/high16 v1, 0x10000000

    invoke-virtual {v0, v1}, Landroid/content/Intent;->addFlags(I)Landroid/content/Intent;

    .line 67
    invoke-virtual {p0, v0}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

    .line 68
    return-void
.end method

.method public static startDownload(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)V
    .registers 14
    .param p0, "url"    # Ljava/lang/String;
    .param p1, "appId"    # I
    .param p2, "title"    # Ljava/lang/String;
    .param p3, "desc"    # Ljava/lang/String;
    .param p4, "primaryKey"    # Ljava/lang/String;
    .param p5, "isPostData"    # Z

    .prologue
    .line 24
    invoke-static {p0}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v4

    .line 25
    .local v4, "srcUri":Landroid/net/Uri;
    new-instance v3, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Request;

    invoke-direct {v3, v4}, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Request;-><init>(Landroid/net/Uri;)V

    .line 26
    .local v3, "request":Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Request;
    const/4 v5, 0x1

    invoke-virtual {v3, v5}, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Request;->setVisibleInDownloadsUi(Z)Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Request;

    .line 27
    invoke-virtual {v3, p2}, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Request;->setTitle(Ljava/lang/CharSequence;)Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Request;

    .line 28
    const/4 v5, 0x3

    invoke-virtual {v3, v5}, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Request;->setAllowedNetworkTypes(I)Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Request;

    .line 29
    sget-object v5, Landroid/os/Environment;->DIRECTORY_DOWNLOADS:Ljava/lang/String;

    const-string v6, "/"

    invoke-virtual {v3, v5, v6}, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Request;->setDestinationInExternalPublicDir(Ljava/lang/String;Ljava/lang/String;)Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Request;

    .line 30
    invoke-virtual {v3, p3}, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Request;->setDescription(Ljava/lang/CharSequence;)Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Request;

    .line 31
    invoke-virtual {v3, p4}, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Request;->setPrimaryKey(Ljava/lang/String;)Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Request;

    .line 32
    invoke-virtual {v3, p5}, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Request;->setIsPostData(Z)Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Request;

    .line 34
    if-lez p1, :cond_4d

    .line 35
    const-string v5, "nice_apps"

    sget-object v6, Lcom/zuiapps/sdk/analytics/constant/MobclickConstant$NiceChannelClick;->direct:Lcom/zuiapps/sdk/analytics/constant/MobclickConstant$NiceChannelClick;

    invoke-static {v5, p1, v6}, Lcom/brixd/niceapp/util/DownloadUtils;->analysisDownloadClick(Ljava/lang/String;ILcom/zuiapps/sdk/analytics/constant/MobclickConstant$NiceChannelClick;)V

    .line 37
    new-instance v2, Ljava/util/HashMap;

    invoke-direct {v2}, Ljava/util/HashMap;-><init>()V

    .line 38
    .local v2, "map":Ljava/util/Map;, "Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;"
    const-string v5, "app_id"

    new-instance v6, Ljava/lang/StringBuilder;

    invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V

    const-string v7, ""

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-interface {v2, v5, v6}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 39
    invoke-virtual {v3, v2}, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Request;->setOtherKey(Ljava/util/Map;)Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Request;

    .line 42
    .end local v2    # "map":Ljava/util/Map;, "Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;"
    :cond_4d
    invoke-static {}, Lcom/brixd/niceapp/application/NiceAppApplication;->getMyApplication()Lcom/brixd/niceapp/application/NiceAppApplication;

    move-result-object v0

    .line 43
    .local v0, "context":Landroid/content/Context;
    new-instance v1, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager;

    invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v5

    invoke-virtual {v0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v6

    invoke-direct {v1, v0, v5, v6}, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager;-><init>(Landroid/content/Context;Landroid/content/ContentResolver;Ljava/lang/String;)V

    .line 44
    .local v1, "manager":Lcom/zuimeia/sdk/download/providers/ZMDownloadManager;
    invoke-static {}, Lcom/brixd/niceapp/application/NiceAppApplication;->getMyApplication()Lcom/brixd/niceapp/application/NiceAppApplication;

    move-result-object v5

    invoke-virtual {v1, v5, v3}, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager;->handleEnqueue(Landroid/content/Context;Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Request;)J

    .line 45
    return-void
.end method
